import request from '@/utils/request'

export function getEmployeesList(params) {
  const formOfEmploymentMap = new Map([
    [1, '未知'],
    ['1', '未知'],
    [2, '正式'],
    [3, '非正式']
  ])
  return request({
    url: '/sys/user',
    params,
  })
    .then(res => ({
      rows: res.data.data.rows.map((d, i) => ({
        ...d,
        index: (params.page - 1) * 10 + i + 1,
        formOfEmployment: formOfEmploymentMap.get(d.formOfEmployment),
      })),
      total: res.data.data.total
    }))
    .catch(() => ({}))
}
